package com.kynnnn.cloud.spring_cache_redis.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kynnnn.cloud.spring_cache_redis.constant.UserConstant;
import com.kynnnn.cloud.spring_cache_redis.entity.SysUser;
import com.kynnnn.cloud.spring_cache_redis.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CachePut;
import org.springframework.stereotype.Service;

/**
 * @author Zhudiwei
 * @date 2021/09/16
 **/
@Slf4j
@Service
public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {

    @CachePut(value = UserConstant.CACHE_USER_ID, key = "#user.id")
    public SysUser updateUser(SysUser user) {
        this.updateById(user);
        return user;
    }


}
